package com.daocheng.dc.book.auth.constant;

/**
 * @ClassName RedisKeyConstant
 * @author: 稻城
 * @date: 2025/3/17
 * @Version 1.0
 * @description: TODO
 */
public class RedisKeyConstant {
    /**
     * 验证码 KEY 前缀
     */
    public static final String VERIFICATION_CODE_KEY_PREFIX = "verification_code:";
    /**
     * 稻城书全局ID生成
     */
    public static final String DC_BOOK_ID_GENERATOR_KEY = "dc.book.id.generator";
    /**
     * 用户角色数据 KEY 前缀
     */
    public static final String USER_ROLE_KEY_PREFIX = "user:roles:";
    /**
     * 角色对应key前缀
     */
    public static final String ROLE_PERMISSION_KEY_PREFIX = "role:permission:";

    /**
     * 构建验证码 KEY
     *
     * @param phone
     * @return
     */
    public static String buildVerificationCodeKey(String phone) {
        return VERIFICATION_CODE_KEY_PREFIX + phone;
    }

    /**
     * @param userId
     * @return Long
     * @author 稻城
     * @Date 2025/3/19 0:37
     * @description 构建用户角色数据 KEY
     */
    public static String buildUserRoleKey(Long userId) {
        return USER_ROLE_KEY_PREFIX + userId;
    }


    public static String buildRolePermissionsKey(String roleKey) {
        return ROLE_PERMISSION_KEY_PREFIX + roleKey;
    }
}
